package ar.edu.uba.fi.jmit.aspecter.testUtils;

import javassist.expr.Expr;
import ar.edu.uba.fi.jmit.aspecter.core.interceptor.FieldAccessInterceptor;
import ar.edu.uba.fi.jmit.aspecter.core.interceptor.FieldAccessType;

public class ExceptionBeforeFieldAccessInterceptor extends
		FieldAccessInterceptor {
	
	public ExceptionBeforeFieldAccessInterceptor(String className,
			String fieldName) {
		super(className, fieldName);
	}
	
	public ExceptionBeforeFieldAccessInterceptor(String className,
			String fieldName, FieldAccessType accessType) {
		super(className, fieldName, accessType);
	}

	@Override
	protected String aspectStatementAfter() {
		return "";
	}

	@Override
	protected String aspectStatementBefore() {
		return "throw new RuntimeException(\"intercepted!\");";
	}

	@Override
	public boolean mustAspect(Expr expression) {
		return true;
	}

}
